<style scoped>
  .weui_msg_desc span {
    padding: 0 3px;
  }
</style>
<template>
  <div class="weui_msg" style="background: #eee;">
    <div class="weui_text_area" style="padding: 15px 0;font-weight: 100;">
      <h3 class="weui_msg_title" style="font-weight: normal;">拉货二维码</h3>
      <p class="weui_msg_desc">
      </p>
    </div>
    <div class="weui_icon_area">
      <h2 class="weui_msg_title"><img width="100%" :src="'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' + ticket" alt=""></h2>
      <p class="weui_msg_desc" style="padding: 0 18px;font-size: 14px;">
          <span>{{partb}}</span>
          <span>{{arealand}}</span>
          <span>{{paymentmethod == 1 ? '装车付' : '验收付'}}</span>
          <span>{{str}}</span>
      </p>
      <p class="weui_msg_desc">
        <!-- 可朋友通过你发的二维码注册、实名认证、并增加车辆后，你将收到平台奖励的微信发红包。 -->
      </p>
    </div>
    <div class="weui_text_area">
      <h2 class="weui_msg_title"></h2>
      <p class="weui_msg_desc">

      </p>
    </div>
    <div class="weui_opr_area" style="margin-top: 10px;">
      <p class="weui_btn_area">
        <a href="javascript:;" @click="$router.back(-1)" class="weui_btn weui_btn_primary">返回</a>
      </p>
    </div>

    <div class="weui_extra_area">

    </div>
  </div>
</template>

<script>
  import wx from 'weixin-js-sdk';
  import SalesOperationLogs2 from '@/components/common/SalesOperationLogs2'

  export default {
  name: 'LoadQrcode',
  data () {
    return {
      title: '',
      partb: '',
      arealand: '',
      paymentmethod: '',
      str: '',
      code: '',
      ticket: ''
    }
  },
  mounted () {
    this.code = this.$route.query.code;
    this.title = this.$route.query.title;
    this.partb = this.$route.query.partb;
    this.arealand = this.$route.query.arealand;
    this.paymentmethod = this.$route.query.paymentmethod;
    this.str = this.$route.query.str;

    this.getQrcode(this.code);
  },
  methods: {
    getQrcode: function(code) {
      let that = this;
      let postData = {};
      postData.contractcode = code;

      that.axios({
        method: 'post',
        url: '/harvest/Procurementcontract!supplyScanCode.action',
        params: postData
      }).then((response) => {
        //恢复提交按钮可点击
        $('.subbtn').attr('disabled', false).css("pointer-events","auto");
        //关闭提交状态
        $.hideLoading();

        if (response.data.msg == 'success') {
          this.ticket = response.data.data;
          this.$router.push({name: 'LoadQrcode'});
        } else if (response.data.msg == 'fail') {
          this.toastText(response.data.data);
        } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
          //不不设置提示
        } else {
          this.toastError('系统错误');
        }
      }).catch(function (error) {
        //恢复提交按钮可点击
        $('.subbtn').attr('disabled', false).css("pointer-events","auto");
        //关闭提交状态
        $.hideLoading();
        that.toastError('系统错误');
      });
    }
}
}
</script>
